package com.github.roc.security.web.validator;

import com.github.roc.security.service.HelloService;
import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * 描述: 校验器
 * 包名: com.github.roc.security.web.validator
 * 作者: ChenGuop.
 * 日期: 2018/10/15 下午4:16.
 * 项目名称: security-oam
 * 版本: 1.0
 * JDK: since 1.8
 */

public class MyConstraintValidator implements ConstraintValidator<MyConstraint, String> {
  @Autowired
  HelloService helloService;

   public void initialize(MyConstraint constraint) {
   }

   public boolean isValid(String value, ConstraintValidatorContext context) {
     return !value.isEmpty();
//     TODO helloService 实际业务逻辑
   }
}
